//
//  RecommendModel.m
//  Kugou-OC
//
//  Created by BH on 16/6/3.
//  Copyright © 2016年 Sunny. All rights reserved.
//

#import "RecommendModel.h"

@implementation RecommendCommonModel

-(id)initWithDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.imgUrl = dict[@"imgurl"];
        self.title = dict[@"title"];
        self.extra = dict[@"extra"];
        self.play_count = [dict[@"play_count"] integerValue];
        self.specialname = dict[@"specialname"];
        self.publishtime = dict[@"publishtime"];
        self.singername = dict[@"singername"];
        self.intro = dict[@"intro"];
        self.suid = dict[@"suid"];
        self.specialid = dict[@"specialid"];
        self.collectcount = [dict[@"collectcount"] integerValue];
        self.slid = dict[@"slid"];
        self.type = [dict[@"type"] integerValue];
        self.songcount = [dict[@"songcount"] integerValue];
    }
    
    return self;
}

@end

@implementation RecommendModel

+(instancetype)shareRecommend{
    static RecommendModel *recommend = nil;
    static dispatch_once_t predicate;
    dispatch_once(&predicate, ^{
        recommend = [[self alloc] init];
    });
    return recommend;
}

-(id)initWithAdsDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.ad_model = [[RecommendCommonModel alloc] initWithDict:dict];
        self.ad_online = dict[@"online"];
    }
    
    return self;
}

-(id)initWithPersonalDict:(NSDictionary *)dict{
    self = [super init];
    
    if (self) {
        self.pr_model = [[RecommendCommonModel alloc] initWithDict:dict];
        self.pr_from_hash = dict[@"from_hash"];
        self.pr_is_recommend = [dict[@"is_recommend"] boolValue];
    }
    
    return self;
}

-(id)initWithRecDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        
        self.rec_imgurl = dict[@"imgurl"];
        self.rec_title = dict[@"title"];
        self.rec_id = dict[@"id"];
        self.rec_type = [dict[@"type"] integerValue];
        self.rec_online = dict[@"online"];
        self.rec_model = [[RecommendCommonModel alloc] initWithDict:dict[@"extra"]];
    }
    
    return self;
}

-(id)initWithSongDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.son_filename = dict[@"filename"];
        self.son_songname = dict[@"songname"];
        self.son_sqhash = dict[@"sqhash"];
        self.son_hash = dict[@"hash"];
        self.son_mvhash = dict[@"mvhash"];
        self.son_privilege = dict[@"privilege"];
        self.son_filesize = dict[@"filesize"];
        self.son_addtime = dict[@"addtime"];
        self.son_bitrate = [dict[@"bitrate"] integerValue];
        self.son_320filesize = dict[@"320filesize"];
        self.son_accompany = dict[@"Accompany"];
        self.son_isfirst = [dict[@"isfirst"] boolValue];
        self.son_singername = dict[@"singername"];
        self.son_sqfilesize = dict[@"sqfilesize"];
        self.son_singerimgurl = dict[@"singerimgurl"];
        self.son_duration = [dict[@"duration"] integerValue];
        self.son_m4afilesize = dict[@"m4afilesize"];
        self.son_extname = dict[@"extname"];
        self.son_320hash = dict[@"320hash"];
        self.son_sqprivilege = dict[@"sqprivilege"];
        self.son_intro = dict[@"intro"];
        self.son_feetype = [dict[@"feetype"] integerValue];
        self.son_albumid = dict[@"album_id"];
    }
    
    return self;
}

-(id)initWithVlistDict:(NSDictionary *)dict{
    self =[super init];
    if (self) {
        self.vli_des = dict[@"des"];
        self.vli_publishtime = dict[@"public_time"];
        self.vli_title = dict[@"title"];
        self.vli_cate = dict[@"cate"];
        self.vli_vid = dict[@"vid"];
        self.vli_mobilebanner = dict[@"mobile_banner"];
        self.vli_hotnum = [dict[@"hot_num"] integerValue];
    }
    
    return self;
}

-(id)initWithAlbumDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.alb_albumname = dict[@"albumname"];
        self.alb_imgurl = dict[@"imgurl"];
        self.alb_intro = dict[@"intro"];
        self.alb_singerid = dict[@"singerid"];
        self.alb_publishtime = dict[@"publishtime"];
        self.alb_singername = dict[@"singername"];
        self.alb_albumid = dict[@"albumid"];
        self.alb_privilege = dict[@"privilege"];
    }
    
    return self;
}

-(id)initWithCusDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.cus_title = dict[@"title"];
        self.cus_icon = dict[@"icon"];
        self.cus_id = dict[@"id"];
        
        NSArray *temp = dict[@"special"];
        self.cus_special = [NSMutableArray array];
        for (NSDictionary *subDict in temp) {
            RecommendCommonModel *model = [[RecommendCommonModel alloc] initWithDict:subDict];
            [self.cus_special addObject:model];
        }
    }
    
    return self;
}

-(id)initWithEntryDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.ent_model = [[RecommendCommonModel alloc] initWithDict:dict];
    }
    
    return self;
}

-(id)initWithTopicDict:(NSDictionary *)dict{
    self = [super init];
    if (self) {
        self.top_bannerhd = dict[@"bannerhd"];
        self.top_id = dict[@"id"];
        self.top_picurl = dict[@"picurl"];
        self.top_url = dict[@"url"];
        self.top_model = [[RecommendCommonModel alloc] initWithDict:dict];
    }
    
    return self;
}

@end
